package com.yunji.hushuang;

/**
 * 双重检查锁单例
 *
 * @author hushuang
 * @since 2019/9/29
 */
public class DoubleCheckedSingleton {

    private static DoubleCheckedSingleton instance;

    private DoubleCheckedSingleton() {
    }

    public static final DoubleCheckedSingleton getInstance() {
        if (instance == null) {
            synchronized (DoubleCheckedSingleton.class) {
                if (instance == null) {
                    instance = new DoubleCheckedSingleton();
                }
            }
        }
        return instance;
    }
}
